
public class MySelectionSort<T extends Comparable<? super T>> implements Sorter<T> {
		
	public MySelectionSort(){
		
	}
	
	@Override
	public void sort(T[] array) {
		if(array==null){
			throw new NullPointerException();
		}
		if(array.length==1){
			return;
		}
		for(int i=0;i<array.length;i++){
			int min=i;
			int max=i;
			
			for(int j=i;j<array.length-i;j++){
				if(array[min].compareTo(array[j])>=0){
					min=j;
				}else if(array[max].compareTo(array[j])<=0){
					max=j;
				}
			}
			
			if(min==max){
				return;
			}
			
		}
		
	}

}
